home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00024_Glasses under bar + beer bottle Behavior.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  2.6 KB  |  107 lines

  1. property pOrigMember, pDraggingMember, pGlassType, pSpr, pTimer, pIngredient
  2. global gBarTopManager, gWellSprite
  3.  
  4. on beginSprite me
  5.   pSpr = sprite(me.spriteNum)
  6.   pOrigMember = pSpr.member
  7.   if pGlassType = #beer then
  8.     pDraggingMember = member("bee_none")
  9.   else
  10.     pDraggingMember = pOrigMember
  11.   end if
  12.   pIngredient = pGlassType
  13. end
  14.  
  15. on mDoneDragging me
  16.   global gLastIngredient
  17.   if inBonusMode() then
  18.     dropWellItemInBonusRound(pGlassType)
  19.     gLastIngredient = 0
  20.     exit
  21.   end if
  22.   newBarSlot = placeGlassOnBar(gWellSprite)
  23.   newSlot = newBarSlot[#closest]
  24.   if newSlot > 0 then
  25.     if (newBarSlot[#open] = 1) or (newBarSlot[#empty] = 1) then
  26.       removeBarTopGlass(gBarTopManager, newBarSlot[#closest])
  27.       setBarTopGlass(gBarTopManager, newBarSlot[#closest], pDraggingMember, pGlassType, 0, VOID, #noGarnish)
  28.       soundFX("mGlass_on_bartop", 0, 0)
  29.     else
  30.       if newBarSlot[#status] = #served then
  31.         chillYouveServedDrink()
  32.       else
  33.         remindAboutEmptyButton()
  34.       end if
  35.     end if
  36.   end if
  37. end
  38.  
  39. on mouseDown me
  40.   global gWarnedAboutGlassesUnderBar, gGameLevel
  41.   if the doubleClick then
  42.     exit
  43.   end if
  44.   if draggingAnything() then
  45.     replaceDraggingAnything()
  46.     if (pGlassType <> #beer) and ((gGameLevel = 1) or not gWarnedAboutGlassesUnderBar) then
  47.       if voidp(gWarnedAboutGlassesUnderBar) then
  48.         gWarnedAboutGlassesUnderBar = 1
  49.       else
  50.         gWarnedAboutGlassesUnderBar = gWarnedAboutGlassesUnderBar + 1
  51.       end if
  52.       remindToChooseGlass()
  53.     end if
  54.   else
  55.     menuDown = nowTicks()
  56.     clickSound()
  57.     repeat while the stillDown
  58.       if ticksSince(menuDown) > 10 then
  59.         forceToolTip(pSpr, pGlassType, the clickLoc)
  60.       end if
  61.       checkElapsedTime()
  62.       updateStage()
  63.     end repeat
  64.     mPickMeUp()
  65.   end if
  66. end
  67.  
  68. on mPickMeUp me
  69.   global gIceSounds
  70.   replaceDraggingAnything()
  71.   returnToBar(VOID, 1)
  72.   if (pGlassType = #beer) and gIceSounds then
  73.     pickupSound = "beer_ice"
  74.   else
  75.     pickupSound = #none
  76.   end if
  77.   sendSprite(gWellSprite, #mDragWellItem, pSpr, pDraggingMember, VOID, pGlassType, pickupSound)
  78. end
  79.  
  80. on getPropertyDescriptionList
  81.   return [#pGlassType: [#default: #shot, #comment: "Type of glass:", #format: #symbol, #range: [#shot, #collins, #cocktail, #old_fashioned, #hiball, #shaker, #mixingGlass, #blender, #beer]]]
  82. end
  83.  
  84. on mouseEnter me
  85.   if not draggingAnything() then
  86.     pTimer = nowTicks()
  87.     showToolTip(pSpr, pGlassType)
  88.   end if
  89. end
  90.  
  91. on mouseLeave me
  92.   if not draggingAnything() then
  93.     hideToolTip()
  94.   end if
  95. end
  96.  
  97. on mouseWithin
  98.   if draggingAnything() then
  99.   else
  100.     if tipTickRange(pTimer) then
  101.       forceToolTip(pSpr, pGlassType)
  102.     else
  103.       dismissToolTip()
  104.     end if
  105.   end if
  106. end
  107.